import React from 'react';
import { useNavigate } from 'react-router-dom';
import './index.css';

interface BackButtonProps {
  onClick?: () => void;
  className?: string;
}

const BackButton: React.FC<BackButtonProps> = ({ onClick, className }) => {
  const navigate = useNavigate();

  const handleClick = () => {
    if (onClick) {
      onClick();
    } else {
      navigate(-1);
    }
  };

  return (
    <div 
      className={`back-button ${className || ''}`}
      onClick={handleClick}
    >
      <div className="back-button__icon">←</div>
    </div>
  );
};

export default BackButton; 